<template>
	<view>
		<!-- 底部导航栏 -->
		<wyg-bottom-tab-withcenter :tabIndex="tab_index_click" @select_click="select_click"></wyg-bottom-tab-withcenter>
	</view>
</template>

<script>
	import wygBottomTabWithcenter from '@/components/wyg-bottom-tab/wyg-bottom-tab-withcenter.vue';
	export default {
		components: {wygBottomTabWithcenter},
		data() {
			return {
				tab_index_click:"1" 
			}
		},
		onLoad(options) {
			console.log("初始化");
           uni.showLoading();
           let userInfo = uni.getStorageSync('userInfo') || '';
           if(userInfo.id){
           	uni.request({
           		url:'https://jialianxin.cn/api/user/getUserPage',
           		method:'GET',
           		data:{
           			user_id:userInfo.id
           		},
           		traditional: true, 
           		success:(res)=> {
					console.log("page>>>>>>>>",res.data.data.special_page);
           			if(res.data.data.special_page!="0"){
           			  uni.setStorageSync("special_page",res.data.data.special_page);
           			  uni.redirectTo({
           			  	url:"/pages/center/index_shop"
           			  })
           			}else{
           			   uni.redirectTo({
           				url:"/pages/center/index"
           			   })
           			}
           			setTimeout(()=>{
           				uni.hideLoading();
           			},300)
           		}
           	})
           }else{
			   uni.hideLoading();
			   uni.redirectTo({
			   		url:"/pages/login/login"
			   })
		   }
		   
		},
		methods: {
			//底部导航
			select_click(callback){
				callback(this.tab_index_click);
			}
		}
	}
</script>

<style>
	
</style>
